from flask import Flask, jsonify, render_template
import pandas as pd

app = Flask(__name__)

#渲染网页
@app.route('/')
def index():
    return render_template('index.html')

@app.route('/get_job_frequency')
def get_job_frequency():
    # 读取之前生成的职位频率统计数据
    df = pd.read_excel('../职位频率统计.xlsx', engine='openpyxl')

    # 将数据转换为字典格式，发送给前端
    result = df.to_dict(orient='records')
    return jsonify(result)

if __name__ == '__main__':
    app.run(debug=True)
